//package com.jiangsong.batch;
//
//import org.springframework.batch.core.Job;
//import org.springframework.batch.core.JobExecution;
//import org.springframework.batch.core.JobParameters;
//import org.springframework.batch.core.JobParametersBuilder;
//import org.springframework.batch.core.launch.JobLauncher;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.scheduling.annotation.EnableScheduling;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
//@Component
//@EnableScheduling
//public class ScheduledTasks {
//    private final JobLauncher jobLauncher;
//    private final Job job;
//
//    @Autowired
//    public ScheduledTasks(JobLauncher jobLauncher, Job job) {
//        this.jobLauncher = jobLauncher;
//        this.job = job;
//    }
//
//    @Scheduled(cron = "0 0/1 * * * *")// 每分钟执行一次，可根据需要修改cron表达式
//    public void runBatchJob() {
//        try {
//            JobParameters jobParameters = new JobParametersBuilder()
//                    .addLong("time", System.currentTimeMillis())
//                    .addLong("myNum", 6L)
//                    .toJobParameters();
//            JobExecution jobExecution = jobLauncher.run(job, jobParameters);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }
//}